<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "shbb_product_auth".
 *
 * @property integer $id
 * @property string $type
 * @property string $department
 * @property string $detail
 * @property string $path
 * @property integer $audit_time
 * @property string $comment
 * @property integer $state
 * @property integer $product_id
 * @property integer $audit_account_id
 *
 * @property User $id0
 * @property ShbbProduct $product
 */
class ProductAuth extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'shbb_product_auth';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['detail', 'comment'], 'string'],
            [['audit_time', 'state', 'product_id', 'audit_account_id'], 'integer'],
            [['type', 'department', 'path'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'type' => 'Type',
            'department' => 'Department',
            'detail' => 'Detail',
            'path' => 'Path',
            'audit_time' => 'Audit Time',
            'comment' => 'Comment',
            'state' => 'State',
            'product_id' => 'Product ID',
            'audit_account_id' => 'Audit Account ID',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getId0()
    {
        return $this->hasOne(User::className(), ['id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getProduct()
    {
        return $this->hasOne(ShbbProduct::className(), ['id' => 'product_id']);
    }
}
